'use strict';

const Controller = require('egg').Controller;

class OrderController extends Controller {
  async index () {
    const { ctx } = this;
    const data = ctx.request.body;
    const res = await ctx.service.order.postorder(data);
    ctx.body = res;
  }
  async getuserorder () {
    const data = this.ctx.query;
    const { ctx } = this;
    const res = await ctx.service.order.getuserorder(data);
    ctx.body = res;
  }
  async getuserorderinfo () {
    const data = this.ctx.query;
    const { ctx } = this;
    const res = await ctx.service.order.getuserorderinfo(data);
    ctx.body = res;
  }
  async getclientorders () {
    const data = this.ctx.query;
    const { ctx } = this;
    const res = await ctx.service.order.getclientorders(data);
    ctx.body = res;
  }
  async getorders () {
    const data = this.ctx.query;
    const { ctx } = this;
    const res = await ctx.service.order.getorders(data);
    ctx.body = res;
  }
  // 管理员审核订单
  async auditorder () {
    const { ctx } = this;
    const data = ctx.request.body;
    const res = await ctx.service.order.auditorder(data);
    ctx.body = res;
  }
  // 管理员修改订单
  async updateorder () {
    const { ctx } = this;
    const data = ctx.request.body;
    const res = await ctx.service.order.updateorder(data);
    ctx.body = res;
  }
  // 管理员删除订单
  async delorder () {
    const data = this.ctx.query;
    const { ctx } = this;
    const res = await ctx.service.order.delorder(data);
    ctx.body = res;
  }
  // 物流信息搜索
  async getuserorder_mapsearch () {
    const data = this.ctx.query;
    const { ctx } = this;
    const res = await ctx.service.order.mapsearch(data);
    ctx.body = res;
  }
  // 后台地图数据（订单）
  async getmapdata () {
    const data = this.ctx.query;
    const { ctx } = this;
    const res = await ctx.service.order.getmapdata(data);
    ctx.body = res;
  }
}

module.exports = OrderController;
